document.domain="hc360.com";

/*
 * 判断页面是否支持AJAX
 */
var bXmlHttpSupport = (typeof XMLHttpRequest != "undefined" || window.ActiveXObject);
if (typeof XMLHttpRequest == "undefined" && window.ActiveXObject) {
	function XMLHttpRequest() {
		var arrSignatures = [
							 "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
                             "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP",
                             "Microsoft.XMLHTTP"
                            ];
                             
		for (var i=0; i < arrSignatures.length; i++) {
			try {        
				var oRequest = new ActiveXObject(arrSignatures[i]);            
				return oRequest;        
			} catch (oError) { 
				/*ignore*/ 
			}
		}          
		throw new Error("MSXML is not installed on your system.");               
	}
}  

/*
 *添加评论内容
 */
function addComment(){
	// 判断发布的内容不能为空
	var newcontent = document.getElementById("newContent").value;
	var content=newcontent.replace(/[ ]/g,"");
	var reprn=newcontent.replace(/[\r\n]/g,"");
	if( content == null || content == '' || reprn==null || reprn==''){
		alert('评论内容不能为空，请输入评论内容！');
		return ;
	}
	
	// 判断是否屏蔽用户，返回true or false 
	blockuser( document.getElementById("areacode").value , document.getElementById("userName").value);
	var blockType = document.getElementById('blockType').value ;
	if( blockType == 'true' ){
		alert('用户已屏蔽');
		return ;
	}
	
	// 判断发布用户类型是否允许
	var userType = document.getElementById('userType').value ;
	var modelUserType = document.getElementById('modelUserType').value ;
	var systype = document.getElementById('systype').value ;
	if(modelUserType > userType ){
		alert('如果您是会员，请先登录后再发布评论！如果您还不是会员，则请先注册！');
		ssologin4lastlw();
		return;
	}
		
	// 判断发布频次，是否允许
	validatePinci(document.getElementById("areacode").value ,document.getElementById("userName").value,
			      document.getElementById("ip").value ,document.getElementById("infoid").value,
				  document.getElementById("modelFrequence").value);
				  
	var isok = document.getElementById("valiresult").value;
	if(isok=='false'){
		if(document.getElementById("modelFrequence").value=='1'){
			alert("您刚刚评论，请稍后再发布您的评论信息，谢谢您的关注!");
		}else if(document.getElementById("modelFrequence").value=='2'){
			alert("您当天已评论，谢谢您的关注！");
		}
		return;
	}

	// 获取用户名
	var username = document.getElementById("userName").value ;
	if(document.getElementById("userName").value == '' ){
		username = document.getElementById("ip").value;
	}
	
	//异步发布评论
	contentIn2db(newcontent,userType,username,'0',systype);
	
	// 保留评论的换行
	newcontent=newcontent.replace("<br>","&lt;br&gt;");
	newcontent=newcontent.replace(/[\n]/g,"<br>");
	newcontent=newcontent.replace("&nbsp", "&amp;nbsp");
	newcontent=newcontent.replace(/[ ]/g,"&nbsp");

	//处理页面效果： 添加一排 
	var time = getNowTime() ;
	var objtemp =document.getElementById('dlid');
	//newcontent=document.getElementById('CLcontent').value;
	if(objtemp == null || objtemp == '' ){
		//添加一排 一条评论也没有时
		appendCommentContent1(document.getElementById("systype").value,username , time ,newcontent ,document.getElementById("areacode").value , document.getElementById("templateid").value ,  document.getElementById("infoid").value) ;
	}else{
		// 处理页面效果： 添加一排 
		appendCommentContent2(username , time ,newcontent ) ;
	}
	
	//自适应高度调整
	setBbsCookie('frameHeight',window.document.body.scrollHeight);
	setIframeHeight();
	// 总数加1  
	totalnumIncreate() ;
	//判断页面条数，是否要删除最后一条
	var maxLeaveword = document.getElementById("maxLeaveword").value;
	var nowlength = document.getElementById("total").value ;

	//评论内容置空
	document.getElementById("newContent").value = '' ;
	alert("评论发布成功，感谢您的关注！");
}

/*
 *	根据行业判断该用户是否被屏蔽
 */
function blockuser( areacode , username) {    
	if(bXmlHttpSupport) {
		var sUrl = '/comment/lwajax/block?areacode='+areacode+'&userName='+username;
		var oRequest = new XMLHttpRequest();
		oRequest.onreadystatechange = function() { 
			if(oRequest.readyState == 4) { 
				var blockuser = eval('(' + oRequest.responseText + ')');
				var block = blockuser.block ;
				document.getElementById('blockType').value = block ;
			}
		};
		oRequest.open('POST', sUrl);
		oRequest.send(null);
	}
}
	
/*
 *获取当前时间
 */
function getNowTime(){
	// 获取当前时间
	var now= new Date();
	var year=now.getYear();
	var month=now.getMonth()+1;
	var day=now.getDate();
	var hour=now.getHours();
	var minute=now.getMinutes();
	var second=now.getSeconds();
	if(second.length==1){
		second="0"+second;
	}
	var nowtime = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;
	return nowtime ;
}

/*
 * 评论内容插入至数据库
 */
function contentIn2db(newcontent ,userType , username,leavewordType,systype){
	var url = "/comment/lw/add";
	var oRequest = new Ajax.Request(
		url,
		{
			method:'post',
			parameters: {
				content: newcontent,
			   	areacode : document.getElementById("areacode").value,
				userType: userType,
				systype:systype,
				username: username ,
				ip: document.getElementById("ip").value,
				infoid: document.getElementById("infoid").value,
				topicId: document.getElementById("topicId").value,
				hfLeavewordid: document.getElementById("hfLeavewordid").value,
				leavewordType: leavewordType
			}
		}
	);
}

/*
 * 评论顶插入至数据库
 */
function dingIn2db(leavewordid ){
	var url = "/comment/lw/ding";
	var oRequest = new Ajax.Request(
		url,
		{
			method:'post',
			parameters: {
				leavewordid: leavewordid,
			   	areacode : document.getElementById("areacode").value
			}
		}
	);
}	

//评论总数+1 的页面效果
function totalnumIncreate(){
	// 总数加1  
	var totaltemp =	document.getElementById('total').value ;
	var res = totaltemp*1 +1 ;
	document.getElementById('totalsum').innerHTML = '最新评论(共'+res+'条)' ;
	document.getElementById('total').value = res ;
}

//发布评论，且已有评论时，页面效果显示增加一行
function appendCommentContent2(username , time ,newcontent ,floor_content ){
	var writedt = "";
	if(document.getElementById('userType').value==1){
		writedt = "<span class='floatLeft'>"+username+"</span><span class='floatRight'>发表时间:"+ time +"</span>";
	}else{
		writedt = "<span class='floatLeft'>"+document.getElementById('city').value+"用户:"+document.getElementById('ip').value+"</span><span class='floatRight'>发表时间:"+ time +"</span>";
	}
	if(!floor_content){
    	floor_content='';
    }
	var writedd = floor_content + "<p>" + newcontent + "</p><p class='commentIcon textRight clear1'></p>" ;

	var s=document.getElementById('dlid');
	var t=s.childNodes.length;
	
	var dttemp= document.createElement("dt");
	var ddtemp=document.createElement("dd");
	dttemp.className="clear1 fontBlue";
	ddtemp.className="clear1";
	dttemp.innerHTML=writedt;
	ddtemp.innerHTML=writedd;
	s.insertBefore(dttemp,s.childNodes[0]);
	s.insertBefore(ddtemp,s.childNodes[1]);
}

//发布评论，且没有评论时，页面效果显示增加一行
function appendCommentContent1(systype,username , time ,newcontent ,areacode , templateid , infoid  ){
	var writedt = "";
	if(document.getElementById('userType').value==1){
		writedt = "<span class='floatLeft'>"+username+"</span><span class='floatRight'>发表时间:"+ time +"</span>";
	}else{
		writedt = "<span class='floatLeft'>"+document.getElementById('city').value+"用户:"+document.getElementById('ip').value+"</span><span class='floatRight'>发表时间:"+ time +"</span>";
	}
	var writedd = "<p>" + newcontent + "</p>" ;
	var container=document.getElementById('container');
	var size = container.childNodes.length ;
//	var divtemp = document.createElement("<div class='otemCon' id='lastlwdiv' >");
	var divtemp = document.createElement("div");
	divtemp.className="otemCon" ;
	divtemp.id="lastlwdiv" ;
	divtemp.innerHTML = "<h4 class='clear1'><em id='totalsum'>最新评论(共1条)</em></h4>" +
						"<dl id='dlid' >" +
			 			"<dt class='clear1 fontBlue'>" + writedt + "</dt>" + "<dd class='clear1'>" + writedd + "</dd>" + 
			 			" <dd class='textRight'><a href='morelw.action?areacode="+areacode+"&systype="+systype+"&templateid="+templateid+"&infoid="+infoid+"&type=0' target='_blank' class='icon8 marR10 marT5 marB5 darkBlue'>更多评论</a></dd>" + 
						"</dl>" ;
	container.insertBefore(divtemp , container.childNodes[0]);
}
	
//顶、支持评论
function dingClick(index){
	var span = document.getElementById('ding_'+index);
	var dingnum = span.innerHTML*1 + 1 ;
	span.innerHTML = dingnum ;
	document.getElementById('img_'+index).onclick = '' ;

	//ajax异步数据库同步
	var leavewordid = document.getElementById('index_'+index).value ;
	dingIn2db(leavewordid ) ;
	slideInfo(document.getElementById('img_'+index),'谢谢支持！');	
}

//点击回复，被回复的留言ID赋值,弹出浮层
function huifuClick(index){
	var leavewordid = document.getElementById('index_'+index).value ;
	document.getElementById('index_temp').value = index ;
	document.getElementById('hfLeavewordid').value = leavewordid ;
}

//回复评论发布
function hfAddContent(){
	//判断发布的内容不能为空 \r\n
	var newcontent = document.getElementById("hfContent").value;
	var content=newcontent.replace(/[ ]/g,"");
	var reprn=newcontent.replace(/[\r\n]/g,"");
	if( content == null || content == '' || reprn==null || reprn==''){
		alert('评论内容不能为空，请输入评论内容！');
		return ;
	}
	
	//判断是否屏蔽用户，返回true or false 
	blockuser( document.getElementById("areacode").value ,document.getElementById("userName").value);
	var blockType = document.getElementById('blockType').value ;
	if( blockType == 'true' ){
		alert('用户已屏蔽');
		return ;
	}

	//判断发布用户类型是否允许
	var userType = document.getElementById('userType').value ;
	var modelUserType = document.getElementById('modelUserType').value ;
	if(modelUserType > userType ){
		alert('如果您是会员，请先登录后再发布评论！如果您还不是会员，则请先注册！');
		ssologin4lastlw();
		return;
	}
		
	//判断发布频次，是否允许
	validatePinci(document.getElementById("areacode").value ,document.getElementById("userName").value,
			      document.getElementById("ip").value ,document.getElementById("infoid").value,
				  document.getElementById("modelFrequence").value);
	var isok = document.getElementById("valiresult").value;
	if(isok=='false'){
		if(document.getElementById("modelFrequence").value=='1'){
			alert("您刚刚评论，请稍后再发布您的评论信息，谢谢您的关注!");
		}else if(document.getElementById("modelFrequence").value=='2'){
			alert("您当天已评论，谢谢您的关注！");
		}
		return;
	}
		
	//获取用户名
	var username = "";
    var systype = document.getElementById("systype").value ;
	if(document.getElementById("userName").value == '' ){
		username = document.getElementById("ip").value;
	}else{
		username = document.getElementById("userName").value;
	}
	//异步发布评论
	contentIn2db(newcontent ,userType , username,'1',systype ) ;
	//处理页面效果： 添加一排 

	var time = getNowTime() ;
	// 处理页面效果： 添加一排 
	//get floor content
	var temp_floor = document.getElementById("index_temp").value ;
	var id_te = "leavewordlist_"+temp_floor;
	var floor_content = realtimeShowCommentItem(id_te);
	
	newcontent=newcontent.replace("<br>","&lt;br&gt;");
	newcontent=newcontent.replace(/[\n]/g,"<br>");
	newcontent=newcontent.replace("&nbsp", "&amp;nbsp");
	newcontent=newcontent.replace(/[ ]/g,"&nbsp");
	appendCommentContent2(username , time ,newcontent,floor_content ) ;
	
	//自适应高度调整
	setBbsCookie('frameHeight',window.document.body.scrollHeight);
	setIframeHeight();
	// 总数加1  
	totalnumIncreate() ;
	//判断页面条数，是否要删除最后一条
	var maxLeaveword = document.getElementById("maxLeaveword").value;
	var nowlength = document.getElementById("total").value ;
	if(nowlength > maxLeaveword ){

	}
	//评论内容置空
	document.getElementById("hfContent").value = '' ;	
	popupw.closeP();
	alert("评论发布成功，感谢您的关注！");	
}

// -------------------盖楼 和 分页部分-------------------------
function jsonListResult(divid,messageid,ModelIsaudit,ishyzx){
	var sUrl = '/comment/lwajax/parent?id='+messageid+"&ModelIsaudit="+ModelIsaudit;   
	if(ishyzx!=undefined){
		sUrl = '/comment/lwajax/parent?id='+messageid;  
	}
	var oRequest = new XMLHttpRequest();
	oRequest.onreadystatechange = function(){   
		if(oRequest.readyState == 4) {
			var list = eval("(" + oRequest.responseText + ")");   
			for(var i=0;i<list.length;i++){
				var f = document.getElementById(divid).getElementsByTagName("div").length;
				if(f==0){
					var firstdiv = document.getElementById(divid).innerHTML;
					var splitvalue="";
					for(var sp=0;sp<2;sp++){
						var array = firstdiv.split("</h5>");
						if(array.length==1){
							splitvalue="</H5>";
						}else{
							splitvalue="</h5>";
						}
					}
					
					var array = firstdiv.split(splitvalue);
					var table1 = array[0]+splitvalue;
					var table2 = array[1];
					var table="";
					var newcontent=list[i].filterContent;
						newcontent=newcontent.replace(/h_hcbr/g,"<br>");
					
					if(ishyzx!=undefined){
						if(list[i].userType==1){
							table=table1+"<DIV><h4><em class='fontBlue'>"+list[i].userName+"</em></h4><h5>发表时间："+list[i].pubdate+"</h5><p>"+newcontent+"</p></DIV>"+table2;
						}else{
							table=table1+"<DIV><h4><em class='fontBlue'>"+"慧聪"+list[i].city+":</em>"+list[i].ip+"</h4><h5>发表时间："+list[i].pubdate+"</h5><p>"+newcontent+"</p></DIV>"+table2;
						}					
					}else{
						if(list[i].userType==1){
							table=table1+"<DIV><h4><em class='fontBlue'>"+list[i].userName+"</em></h4><h5>发表时间："+list[i].pubdate+"</h5><p>"+(list[i].display==0?"该楼层内容隐藏，暂不显示!":newcontent)+"</p></DIV>"+table2;
						}else{
							table=table1+"<DIV><h4><em class='fontBlue'>"+"慧聪"+list[i].city+":</em>"+list[i].ip+"</h4><h5>发表时间："+list[i].pubdate+"</h5><p>"+(list[i].display==0?"该楼层内容隐藏，暂不显示!":newcontent)+"</p></DIV>"+table2;
						}						
					}
					firstdiv.innerHTML="";
					document.getElementById(divid).innerHTML=table;
				}else{
					var obj = document.getElementById(divid).getElementsByTagName("div");  
					var secdiv = obj[obj.length-1].innerHTML;
					var splitvalue="";
					for(var sp=0;sp<2;sp++){
						var array = firstdiv.split("</h5>");
						if(array.length==1){
							splitvalue="</H5>";
						}else{
							splitvalue="</h5>";
						}
					}
					var array = secdiv.split(splitvalue);
					var table1 = array[0]+splitvalue;
					var table2 = array[1];
					var table = "";
					var newcontent=list[i].filterContent;
						newcontent=newcontent.replace(/h_hcbr/g,"<br>");
					if(ishyzx!=undefined){
						if(list[i].userType==1){
							table=table1+"<DIV><h4><em class='fontBlue'>"+list[i].userName+"</em></h4><h5>发表时间："+list[i].pubdate+"</h5><p>"+newcontent+"</p></DIV>"+table2;
						}else{
							table=table1+"<DIV><h4><em class='fontBlue'>"+list[i].city+":</em>"+list[i].ip+"</h4><h5>发表时间："+list[i].pubdate+"</h5><p>"+newcontent+"</p></DIV>"+table2;
						}
					}else{
						if(list[i].userType==1){
							table=table1+"<DIV><h4><em class='fontBlue'>"+list[i].userName+"</em></h4><h5>发表时间："+list[i].pubdate+"</h5><p>"+(list[i].display==0?"该楼层内容隐藏，暂不显示!":newcontent)+"</p></DIV>"+table2;
						}else{
							table=table1+"<DIV><h4><em class='fontBlue'>"+"慧聪"+list[i].city+":</em>"+list[i].ip+"</h4><h5>发表时间："+list[i].pubdate+"</h5><p>"+(list[i].display==0?"该楼层内容隐藏，暂不显示!":newcontent)+"</p></DIV>"+table2;
						}
					}
					
					obj[obj.length-1].innerHTML="";
					obj[obj.length-1].innerHTML=table;
					popupw.popupInit('container','goReply','replyWrap','middle');
				}
			}
       	}   
   	} 
	oRequest.open("POST",sUrl);   
    oRequest.send(null);    
}   
// -------------------盖楼 和 分页部分-------------------------

// -------------------动态分页部分 ----------------------------
// 循环出页码
function goonfy(){
	var nu=0;
	var linka="";
	var value1=document.getElementById('dangqianye').value*1;
	var value2=document.getElementById('pageCount').value*1;
	var selecttype=document.getElementById('allor').value;
	var leavewordtype=document.getElementById('leavewordtype').value;
	
	if(value1+3 > value2 && value2>4){
		for(var i=(value2-3);i<=value2;i++){
  			nu++;
  			if(value1==i){
	  			linka+="<a href='javascript:doQueryPage("+leavewordtype+","+i+","+selecttype+")' class='fontChunRed'>"+i+"</a>" + "  ";
	  		}else{
	  			linka+="<a href='javascript:doQueryPage("+leavewordtype+","+i+","+selecttype+")'>"+i+"</a>" + "  ";
	  		}
	  		if(nu>=4){
  				document.getElementById('gonext1').value=nu;
  				break;
	  		}
  		}
	}else{
		if(document.getElementById('pageCount').value*1<=4){
			value1=1;
		}
		for(var i=value1;i<=value2;i++){
  			nu++;
  			if(document.getElementById('dangqianye').value*1==i){
  				linka+="<a href='javascript:doQueryPage("+leavewordtype+","+i+","+selecttype+")' class='fontChunRed'>"+i+"</a>" + "  ";
  			}else{
  				linka+="<a href='javascript:doQueryPage("+leavewordtype+","+i+","+selecttype+")' >"+i+"</a>" + "  ";
  			}
	  		
	  		if(nu>=4){
  				document.getElementById('gonext1').value=nu;
  				break;
		  	}
  		}	
	}
	
	// 上行分页
  	document.getElementById('fyS').innerHTML="";
  	document.getElementById('fyS').innerHTML=linka;
  	
  	// 下行分页
  	if(document.getElementById('fyM')!=null){
  		document.getElementById('fyM').innerHTML="";
	  	document.getElementById('fyM').innerHTML=linka;
  	}
}
// -------------------动态分页部分 ----------------------------

// -------------------执行分页部分 ----------------------------
function doQueryPage(leavewordtype,pageIndex,type){ 
	if(pageIndex==undefined){
		return;
	}
	
	document.getElementById('dangqianye').value=pageIndex;
	numStr  = /^(\d*)?$/;  
	frm=document.getElementById('listForm2');
	var pageIndexEl = document.getElementById('pageIndex');
	if(frm!=null && pageIndexEl!=null){ 
		if (pageIndex!="goto"){
	    	pageIndexEl.value = pageIndex;
	   	}

	   	if(numStr.exec(pageIndexEl.value)!=null && pageIndexEl.value>0){
	   		if(leavewordtype==1){
	   			frm.action="morelw.action?areacode="+document.getElementById('areacode').value+"&systype="+document.getElementById('systype').value+"&templateid="+document.getElementById('templateid').value+"&infoid="+document.getElementById('infoid').value+"&type="+type+"&dangqianye="+document.getElementById('dangqianye').value;
	   		}else if(leavewordtype==2){
		   		frm.action="hyzx.action?systype="+document.getElementById('systype').value+"&type="+type+"&dangqianye="+document.getElementById('dangqianye').value;
	   		}
	    	frm.submit();
	   	}else{
	    	alert('\u9875\u7801\u8f93\u5165\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165!'); 
	   	}
	}
}
// -------------------执行分页部分 ----------------------------

/*
 *添加汇总评论内容
 */
function addComment4HZ(type){
	// 判断发布的内容不能为空
	var newcontent = document.getElementById("newContent").value;
	var content=newcontent.replace(/[ ]/g,"");
	var reprn=newcontent.replace(/[\r\n]/g,"");
	if( content == null || content == '' || reprn==null || reprn==''){
		alert('评论内容不能为空，请输入评论内容！');
		return ;
	}
	
	var username=document.getElementById("userName").value;
	var systype = document.getElementById("systype").value ;
	// 判断是否屏蔽用户，返回true or false 
	blockuser( document.getElementById("areacode").value ,username);
	var blockType = document.getElementById('blockType').value ;
	if( blockType == 'true' ){
		alert('用户已屏蔽');
		return ;
	}
	
	//判断发布用户类型是否允许
	var userType = document.getElementById('userType').value ;
	var modelUserType = document.getElementById('modelUserType').value ;
	if(modelUserType > userType ){
		alert('如果您是会员，请先登录后再发布评论！如果您还不是会员，则请先注册！');
		ssologin();
		return;
	}
	
	validatePinci(document.getElementById("areacode").value ,username,
			      document.getElementById("ip").value ,document.getElementById("infoid").value,
				  document.getElementById("modelFrequence").value);
	var isok = document.getElementById("valiresult").value;
	if(isok=='false'){
		if(document.getElementById("modelFrequence").value=='1'){
			alert("您刚刚评论，请稍后再发布您的评论信息，谢谢您的关注!");
		}else if(document.getElementById("modelFrequence").value=='2'){
			alert("您当天已评论，谢谢您的关注！");
		}
		return;
	}
	//异步发布评论
	contentIn2db(newcontent ,userType , username,'0',systype) ;

	//获取用户名
	if(document.getElementById("userName").value == '' ){
		username = document.getElementById("ip").value;
	}
	
	// 保留评论的换行
	newcontent=newcontent.replace("<br>","&lt;br&gt;");
	newcontent=newcontent.replace(/[\n]/g,"<br>");
	newcontent=newcontent.replace("&nbsp", "&amp;nbsp");
	newcontent=newcontent.replace(/[ ]/g,"&nbsp");
	
	var time = getNowTime() ;
	insertbyid="";
	if(type==0){
		insertbyid="allComment";
	}else{
		insertbyid="hotComment";
	}
	
	var s=document.getElementById(insertbyid);
	var t=s.childNodes.length;
	
	var writediv="";
	if(document.getElementById('userType').value==1){
		writediv="<h4><em class='fontBlue'></em>"+username+"</h4><h5>发表时间："+time+"</h5><p>"+newcontent+"</p>";	
	}else{
		writediv="<h4><em class='fontBlue'>"+document.getElementById('city').value+"用户:</em>"+document.getElementById('ip').value+"</h4><h5>发表时间："+time+"</h5><p>"+newcontent+"</p>";	
	}
	
	//var div= document.createElement("<div class='commentItem'>");
	var div= document.createElement("div");
		div.className="commentItem";
		div.innerHTML=writediv;
	for (var i=0;i<t;i++){
		if (1==-1){
			s.appendChild(div);
		} else if (i==1-1){
			s.insertBefore(div,s.childNodes[i]);
		}
	}
	
	if(t==0){
		s.appendChild(div);
	}
	//评论内容置空
	document.getElementById("newContent").value = '' ;
	
	// 总数加1  
	document.getElementById('hotCommentbtn').innerHTML="全部评论(共"+(document.getElementById('allNum').value*1+1)+"条)";
	document.getElementById('allNum').value=document.getElementById('allNum').value*1+1;
	alert("评论发布成功，感谢您的关注！");
}

//回复评论发布
function hfAddContent4HZ(type){
	//判断发布的内容不能为空
	var newcontent = document.getElementById("hfContent").value;
	var content=newcontent.replace(/[ ]/g,"");
	var reprn=newcontent.replace(/[\r\n]/g,"");
	if( content == null || content == '' || reprn==null || reprn==''){
		alert('评论内容不能为空，请输入评论内容！');
		return ;
	}
	
	var username=document.getElementById("userName").value;	
	var systype = document.getElementById("systype").value ;
	//判断是否屏蔽用户，返回true or false 
	blockuser( document.getElementById("areacode").value ,username);
	var blockType = document.getElementById('blockType').value ;
	if( blockType == 'true' ){
		alert('用户已屏蔽');
		return ;
	}

	//判断发布用户类型是否允许
	var userType = document.getElementById('userType').value ;
	var modelUserType = document.getElementById('modelUserType').value ;
	if(modelUserType > userType ){
		alert('如果您是会员，请先登录后再发布评论！如果您还不是会员，则请先注册！');
		ssologin();
		return ;
	}
		
	validatePinci(document.getElementById("areacode").value ,username,
			      document.getElementById("ip").value ,document.getElementById("infoid").value,
				  document.getElementById("modelFrequence").value);
	var isok = document.getElementById("valiresult").value;
	if(isok=='false'){
		if(document.getElementById("modelFrequence").value=='1'){
			alert("您刚刚评论，请稍后再发布您的评论信息，谢谢您的关注!");
		}else if(document.getElementById("modelFrequence").value=='2'){
			alert("您当天已评论，谢谢您的关注！");
		}
		return;
	}
	
	//异步发布评论
	contentIn2db(newcontent ,userType , username,'1',systype ) ;
	
	// 处理页面效果： 添加一排 
	//get floor content

	var temp_floor = document.getElementById("index_temp").value ;
	var id_te = "leaveword"+temp_floor;
	var floor_content = realtimeShowCommentItem4hz(id_te);
	
	//获取用户名
	if(document.getElementById("userName").value == '' ){
		username = document.getElementById("ip").value;
	}
	
	// 保留评论的换行
	newcontent=newcontent.replace("<br>","&lt;br&gt;");
	newcontent=newcontent.replace(/[\n]/g,"<br>");
	newcontent=newcontent.replace("&nbsp", "&amp;nbsp");
	newcontent=newcontent.replace(/[ ]/g,"&nbsp");
	var time = getNowTime() ;
	insertbyid="";
	if(type==0){
		insertbyid="allComment";
	}else{
		insertbyid="hotComment";
	}
	var s=document.getElementById(insertbyid);
	var t=s.childNodes.length;
	
	var writediv="";
//	if(document.getElementById('userType').value==1){
//		writediv="<h4><em class='fontBlue'></em>"+username+"</h4><h5>发表时间："+time+"</h5><p>"+ newcontent+"</p>";	
//	}else{
//		writediv="<h4><em class='fontBlue'>"+document.getElementById('city').value+"用户:</em>"+document.getElementById('ip').value+"</h4><h5>发表时间："+time+"</h5><p>"+newcontent+"</p>";	
//	}
	if(document.getElementById('userType').value==1){
		writediv="<h4><em class='fontBlue'></em>"+username+"</h4><h5>发表时间："+time+"</h5><div>"+floor_content+"</div><p>"+ newcontent+"</p>";	
	}else{
		writediv="<h4><em class='fontBlue'>"+document.getElementById('city').value+"用户:</em>"+document.getElementById('ip').value+"</h4><h5>发表时间："+time+"</h5><div>"+floor_content+"</div><p>"+newcontent+"</p>";	
	}	
	
	var div= document.createElement("div");
		div.className="commentItem";
		div.innerHTML=writediv;
		
	for (var i=0;i<t;i++){
		if (1==-1){
			s.appendChild(div);
		} else if (i==1-1){
			s.insertBefore(div,s.childNodes[i]);
		}
	}
	
	document.getElementById("hfContent").value = '' ;	
	//关闭恢复层
	popupw.closeP();
	alert("评论发布成功，感谢您的关注！");	
}

// -------------------最新评论页盖楼 -------------------------
function jsonListResult4Last(divid,messageid,ModelIsaudit){
	var sUrl = '/comment/lwajax/parent?id='+messageid+"&ModelIsaudit="+ModelIsaudit+"";   
	var oRequest = new XMLHttpRequest();
	oRequest.onreadystatechange = function(){   
		if(oRequest.readyState == 4) {  
			var list = eval("(" + oRequest.responseText + ")");   
			var result ;
			var len = list.length-1 ;
			for(var i=len;i>=0;i--){
				var innerStrong ="";
				if(list[i].userType==1){
					innerStrong = "<strong class='fontBlue'><span class='floatRight fontBlue'>["+list[i].pubdate+"]</span>"+list[i].userName+"</strong>" ;
				}else{
					innerStrong = "<strong class='fontBlue'><span class='floatRight fontBlue'>["+list[i].pubdate+"]</span>"+"慧聪"+list[i].city+"用户:"+list[i].ip+"</strong>" ;
				}
	
				var innerContent = "" ;
				if(list[i].display==0){
					innerContent = "<p>该楼层内容隐藏，暂不显示!</p>" ;
				}else{
					var newcontent=list[i].filterContent;
						newcontent=newcontent.replace(/h_hcbr/g,"<br>");
					innerContent = "<p>"+newcontent+"</p>" ;
				}

				if(i == len ){
					result = "<div>"+innerStrong + innerContent+"</div>" ;
				}else{
					result = "<div>"+ innerStrong + result + innerContent +"</div>" ; 
				}
			}
			document.getElementById(divid).innerHTML = result ;
		  	setBbsCookie('frameHeight',window.document.body.scrollHeight);
			setIframeHeight();
       	}   
   	} 
	oRequest.open("POST",sUrl);   
    oRequest.send(null);   
} 
// -------------------最新评论页盖楼 -------------------------

/*
 *发布评论专题
 */
function addComment4zt(){
	// 判断发布的内容不能为空
	var newcontent = document.getElementById("newContent").value;
	var content=newcontent.replace(/[ ]/g,"");
	var reprn=newcontent.replace(/[\r\n]/g,"");
	if( content == null || content == '' || reprn==null || reprn==''){
		alert('评论内容不能为空，请输入评论内容！');
		return ;
	}
	
	// 保留评论的换行
	//newcontent=newcontent.replace(/[\n]/g,"<br>");
	//newcontent=newcontent.replace(/[ ]/g,"&nbsp");
		
	// 判断是否屏蔽用户，返回true or false 
	blockuser( document.getElementById("areacode").value , document.getElementById("userName").value);
	var blockType = document.getElementById('blockType').value ;
	if( blockType == 'true' ){
		alert('用户已屏蔽');
		return ;
	}
	
	//判断发布用户类型是否允许
	var userType = document.getElementById('userType').value ;
	var modelUserType = document.getElementById('modelUserType').value ;
	if(modelUserType > userType ){
		alert('如果您是会员，请先登录后再发布评论！如果您还不是会员，则请先注册！');
		ssologin();
		return;
	}
		
	//判断发布频次，是否允许
	validatePinci(document.getElementById("areacode").value ,document.getElementById("userName").value,
			      document.getElementById("ip").value ,document.getElementById("infoid").value,
				  document.getElementById("modelFrequence").value);
	var isok = document.getElementById("valiresult").value;
	if(isok=='false'){
		if(document.getElementById("modelFrequence").value=='1'){
			alert("您刚刚评论，请稍后再发布您的评论信息，谢谢您的关注!");
		}else if(document.getElementById("modelFrequence").value=='2'){
			alert("您当天已评论，谢谢您的关注！");
		}
		return;
	}
	
	//获取用户名
	var username = document.getElementById("userName").value ;
	var systype = document.getElementById("systype").value ;
	if(document.getElementById("userName").value == '' ){
		username = document.getElementById("ip").value;
	}
	//异步发布评论
		
	contentIn2db(newcontent ,userType , username,'0',systype  ) ;
	
	// 保留评论的换行
	newcontent=newcontent.replace("<br>","&lt;br&gt;");
	newcontent=newcontent.replace(/[\n]/g,"<br>");
	newcontent=newcontent.replace("&nbsp", "&amp;nbsp");
	newcontent=newcontent.replace(/[ ]/g,"&nbsp");
	
	//处理页面效果： 添加一排 
	var infourl = document.getElementById('infourl').value;
	var infotitle = document.getElementById('infotitle').value;
	var time = getNowTime() ;
	var objtemp =document.getElementById('dlid');
	if(objtemp == null || objtemp == '' ){
		//添加一排 一条评论也没有时
		appendCommentContent4zt1(username , time ,newcontent,infourl ,infotitle ,document.getElementById("areacode").value , document.getElementById("templateid").value ,  document.getElementById("infoid").value) ;
	}else{
		// 处理页面效果： 添加一排 
		appendCommentContent4zt2(username , time ,newcontent,infourl ,infotitle ) ;
	}

	// 总数加1  
	totalnumIncreate() ;
	//判断页面条数，是否要删除最后一条
	var maxLeaveword = document.getElementById("maxLeaveword").value;
	var nowlength = document.getElementById("total").value ;
	
	//评论内容置空
	document.getElementById("newContent").value = '' ;
	alert("评论发布成功，感谢您的关注！");
}

/**
 * 回去评论专题
 */
function hfAddContent4zt(){
	// 判断发布的内容不能为空
	var hfcontent = document.getElementById("hfContent").value;
	var content=hfcontent.replace(/[ ]/g,"");
	var reprn=hfcontent.replace(/[\r\n]/g,"");
	if( content == null || content == '' || reprn==null || reprn==''){
		alert('评论内容不能为空，请输入评论内容！');
		return ;
	}
	
	// 判断是否屏蔽用户，返回true or false 
	blockuser( document.getElementById("areacode").value , document.getElementById("userName").value);
	var blockType = document.getElementById('blockType').value ;
	if( blockType == 'true' ){
		alert('用户已屏蔽');
		return ;
	}
	
	//判断发布用户类型是否允许
	var userType = document.getElementById('userType').value ;

	var systype = document.getElementById("systype").value ;
	var modelUserType = document.getElementById('modelUserType').value ;
	if(modelUserType > userType ){
		alert('如果您是会员，请先登录后再发布评论！如果您还不是会员，则请先注册！');
		ssologin();
		return ;
	}
		
	// 判断发布频次，是否允许
	validatePinci(document.getElementById("areacode").value ,document.getElementById("userName").value,
			      document.getElementById("ip").value ,document.getElementById("infoid").value,
				  document.getElementById("modelFrequence").value);
	var isok = document.getElementById("valiresult").value;
	if(isok=='false'){
		if(document.getElementById("modelFrequence").value=='1'){
			alert("您刚刚评论，请稍后再发布您的评论信息，谢谢您的关注!");
		}else if(document.getElementById("modelFrequence").value=='2'){
			alert("您当天已评论，谢谢您的关注！");
		}
		return;
	}
	
	//获取用户名
	var username = document.getElementById("userName").value ;
	if(document.getElementById("userName").value == '' ){
		username = document.getElementById("ip").value;
	}
	
	//异步发布评论   1回复
	contentIn2db(hfcontent ,userType , username,'1',systype ) ;

	// 保留评论的换行
	hfcontent=hfcontent.replace("<br>","&lt;br&gt;");
	hfcontent=hfcontent.replace(/[\n]/g,"<br>");
	hfcontent=hfcontent.replace("&nbsp", "&amp;nbsp");
	hfcontent=hfcontent.replace(/[ ]/g,"&nbsp");
	
	var time = getNowTime() ;
	// 处理页面效果： 添加一排 
	var infourl = document.getElementById('infourl').value;
	var infotitle = document.getElementById('huifutitle').value;
	//get floor content
	var temp_floor = document.getElementById("index_temp").value ;
	var id_te = "leavewordlist_"+temp_floor;
	var floor_content = realtimeShowCommentItem(id_te);
	appendCommentContent4zt2(username , time ,hfcontent,infourl ,infotitle,floor_content ) ;
	// 总数加1  
	totalnumIncreate() ;
	//判断页面条数，是否要删除最后一条
	var maxLeaveword = document.getElementById("maxLeaveword").value;
	var nowlength = document.getElementById("total").value ;
	//评论内容置空
	document.getElementById("hfContent").value = '' ;	
	popupw.closeP();
	alert("评论发布成功，感谢您的关注！");
	document.getElementById('topicId').value=document.getElementById('oldtopicId').value;
	document.getElementById('infoid').value=document.getElementById('oldinfoid').value;
	document.getElementById('infourl').value=document.getElementById('oldinfourl').value;
	document.getElementById('infotitle').value=document.getElementById('oldinfotitle').value;
}

//发布评论，且没有评论时，页面效果显示增加一行,
function appendCommentContent4zt1(username , time ,newcontent ,infourl,infotitle , areacode , templateid , infoid){
	var writedt = "";
	if(document.getElementById('userType').value==1){
		writedt = "<span class='floatLeft'>"+username+"</span><span class='floatRight'>发表时间:"+ time +"</span>";
	}else{
		writedt = "<span class='floatLeft'>"+document.getElementById('city').value+"用户:"+username+"</span><span class='floatRight'>发表时间:"+ time +"</span>";
	}
	var writedd = "<p>" + newcontent + "</p><p class='commentIcon clear1'>"
		+"<strong class='floatLeft darkBlue fontXT fontBold'>"
		+"(对<a href='"+infourl+"' target='_blank' class='fontBlue fontNormal noMar'>" 
		+ infotitle + "</a>的评论)</strong><span class='floatRight'></span>" + "</p>" ;

	var container=document.getElementById('container');
	var size = container.childNodes.length ;
//	var divtemp = document.createElement("<div class='otemCon' id='lastlwdiv' >");
	var divtemp = document.createElement("div");
	divtemp.className="otemCon" ;
	divtemp.id="lastlwdiv" ;
	divtemp.innerHTML = "<h4 class='clear1'><em id='totalsum'>最新评论(共1条)</em></h4>" +
						"<dl id='dlid' >" +
			 			"<dt class='clear1 fontBlue'>" + writedt + "</dt>" + "<dd class='clear1'>" + writedd + "</dd>" + 
			 			" <dd class='textRight'><a href='morelw.action?areacode="+areacode+"&systype=0&templateid="+templateid+"&infoid="+infoid+"&type=0' target='_blank' class='icon8 marR10 marT5 marB5 darkBlue'>更多评论</a></dd>" + 
						"</dl>" ;
	container.insertBefore(divtemp , container.childNodes[0]);
}

//发布评论，且已有评论时，页面效果显示增加一行
function appendCommentContent4zt2(username , time ,newcontent , infourl, infotitle,floor_content){
	var writedt = "";

	if(!floor_content){
    	floor_content='';
    }
	if(document.getElementById('userType').value==1){
		writedt = "<span class='floatLeft'>"+username+"</span><span class='floatRight'>发表时间:"+ time +"</span>";
	}else{
		writedt = "<span class='floatLeft'>"+document.getElementById('city').value+"用户:"+username+"</span><span class='floatRight'>发表时间:"+ time +"</span>";
	}
	var writedd = floor_content + "<p>" + newcontent + "</p><p class='commentIcon clear1'>"
		+"<strong class='floatLeft darkBlue fontXT fontBold'>"
		+"(对<a href='"+infourl+"' target='_blank' class='fontBlue fontNormal noMar'>" 
		+ infotitle + "</a>的评论)</strong><span class='floatRight'></span>" + "</p>" ;
    
	var s=document.getElementById('dlid');
	var t=s.childNodes.length;
	var dttemp= document.createElement("dt");
	dttemp.className="clear1 fontBlue" ;
	var ddtemp=document.createElement("dd");
	ddtemp.className="clear1" ;
	dttemp.innerHTML=writedt;
	ddtemp.innerHTML=writedd;
	
	s.insertBefore(dttemp,s.childNodes[0]);
	s.insertBefore(ddtemp,s.childNodes[1]);
}

/**
 * 收藏
 * @param index
 * @return
 */
function collectlw(index){
	//判断发布用户类型是否允许
	var userType = document.getElementById('userType').value ;
	if (userType == 0){
		//alert('匿名用户，请登录！');
		ssologin();
		return "1";
	}
 	var leavewordid = document.getElementById('index_'+index).value ;
 	var usernmae=document.getElementById('userName').value;
 	var areacode=document.getElementById('areacode').value;
	var url = "/comment/lw/collect";
	var oRequest = new Ajax.Request(
		url,
		{
			method:'post',
			parameters: {
				leavewordid : leavewordid,
				username : usernmae,
				areacode : areacode,
				userType : userType
			}
		}
	);
	return "2" ;
 }

/**
 * 收藏
 * @param index
 * @return
 */
function collectlw4last(index){
	//判断发布用户类型是否允许
	var userType = document.getElementById('userType').value ;
	if (userType == 0){
		//alert('匿名用户，请登录！');
		ssologin4lastlw();
		return "1";
	}
 	var leavewordid = document.getElementById('index_'+index).value ;
 	var usernmae=document.getElementById('userName').value;
 	var areacode=document.getElementById('areacode').value;
	var url = "/comment/lw/collect";
	var oRequest = new Ajax.Request(
		url,
		{
			method:'post',
			parameters: {
				leavewordid : leavewordid,
				username : usernmae,
				areacode : areacode,
				userType : userType
			}
		}
	);
	return "2" ;
 }

/**
 * 转发
 * @param leavewordid
 * @return
 */
function zf(leavewordid,systype){
	var templateid= document.getElementById("templateid").value;
	var url = "http://comment.info.hc360.com/comment/zf/zf?leavewordid="+leavewordid+"&templateid="+templateid+"&systype="+systype;
	copyToClipboard(url);
}

/**
 * JS复制内容到粘贴板
 * @param txt
 * @return
 */
function copyToClipboard(txt) {    
    if(window.clipboardData) {    
            window.clipboardData.clearData();    
            window.clipboardData.setData("Text", txt);    
    } 
    //else if(navigator.userAgent.indexOf("Opera") != -1) {    
    //   window.location = txt;    
   // } 
    else if (window.netscape) {    
         try {    
              netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");    
         } catch (e) {    
              alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");    
         }    
         var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);    
         if (!clip)    
              return;    
         var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);    
         if (!trans)    
              return;    
         trans.addDataFlavor('text/unicode');    
         var str = new Object();    
         var len = new Object();    
         var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);    
         var copytext = txt;    
         str.data = copytext;    
         trans.setTransferData("text/unicode",str,copytext.length*2);    
         var clipid = Components.interfaces.nsIClipboard;    
         if (!clip)    
              return false;    
         clip.setData(trans,null,clipid.kGlobalClipboard);    
    }    
}  

/**
 * 跳转
 * @return
 */
function ssologin(){

	var str ='';
	try{
		str = window.parent.location.href ;
	}catch(e){
		str="http://www.hc360.com" ;
	}

	var temp_action = document.createElement("form");
	temp_action.setAttribute("action", "/comment/ssologin");
	temp_action.setAttribute("method", "post");

	var temp_input = document.createElement("input");
	temp_input.setAttribute("type", "hidden");
	temp_input.setAttribute("name", "tourl");
	temp_input.setAttribute("id", "tourl");
	temp_input.setAttribute("value", str);
	temp_action.appendChild(temp_input) ;
	document.body.appendChild(temp_action) ;
	temp_action.submit();	
}

/**
 * 跳转
 * update by Javy on 20110127
 * @return
 */
function ssologin4lastlw(){
	var str ='';
	try{
		str = window.parent.location.href;
	}catch(e){
		str="http://www.hc360.com" ;
	}

	var temp_action = document.createElement("form");
	temp_action.setAttribute("action", "/comment/ssologin");
	temp_action.setAttribute("method", "post");
	temp_action.setAttribute("target", "_top");
//	var f = document.createElement("<form action='/comment/ssologin' method='post' target='_top'>") ;
//	var f1 = document.createElement("<input type='hidden' name='tourl' id='tourl' value='"+str+"' />") ;
	var temp_input = document.createElement("input");
	temp_input.setAttribute("type", "hidden");
	temp_input.setAttribute("name", "tourl");
	temp_input.setAttribute("id", "tourl");
	temp_input.setAttribute("value", str);
	
	temp_action.appendChild(temp_input) ;
	document.body.appendChild(temp_action) ;
	temp_action.submit();
}

/**
 * 验证用户发布频次
 */
function validatePinci(areacode,username,ip,infoid,modelFrequence){
	if(bXmlHttpSupport) {
		var sUrl = '/comment/lwajax/pc?areacode='+areacode+'&username='+username+'&ip='+ip+'&infoid='+infoid+'&modelFrequence='+modelFrequence;
		var oRequest = new XMLHttpRequest();
		oRequest.onreadystatechange = function() { 
			if(oRequest.readyState == 4) {  
				var pcVali = eval('(' + oRequest.responseText + ')');
				var valiresult = pcVali.result;
				document.getElementById("valiresult").value=valiresult;
			}
		};
		oRequest.open('POST', sUrl);
		oRequest.send(null);
	}
}

//资讯终极页自适应 shm commentiframet
	function setIframeHeight(){		
		var isIE=document.all;
		try{
			if(parent && parent.commentiframeg){
				var bHeight = document.body.scrollHeight;
				var dHeight = document.documentElement.scrollHeight;
				var height = Math.min(bHeight, dHeight);
				if(!isIE) height=dHeight;
				parent.document.getElementById("commentiframeg").height=height;
			}
		}catch(e){}
		try{
			if(parent && parent.bbsiframe){
				var bHeight = document.body.scrollHeight;
				var dHeight = document.documentElement.scrollHeight;
				var height = Math.max(bHeight, dHeight);
				if(!isIE) height=dHeight;
				parent.bbsiframe.height=height;
			
			}	
		}catch(e){}
	}

// ----------------------------------------新分页部分 ... 开始------------------------

function setPage(type){
	var pagenum;
	if(type==0)	{
		if(document.getElementById('dangqianye').value==1){
			alert("已经在第一页了");
			return;
		}else{
			document.getElementById('dangqianye').value =document.getElementById('dangqianye').value*1-1;
			pagenum = document.getElementById('dangqianye').value;
			return pagenum;
		}
	}else{
		allpage = document.getElementById('pageCount').value*1;
		if(allpage>document.getElementById('dangqianye').value*1){
			document.getElementById('dangqianye').value=document.getElementById('dangqianye').value*1+1;
			pagenum = document.getElementById('dangqianye').value;
			return pagenum;
		}else if(allpage<=document.getElementById('dangqianye').value*1){
			alert("已经是最后一页了");
			return;
		}
	}
}

// ----------------------------------------新分页部分 ... 结束------------------------

// ---------------old iframe cookie----------
function setBbsCookie(name, value){
	//var currDate = new Date();
	var cookieString = name + '=' + escape(value);
	
	//currDate.setTime(currDate.getTime() + (expireDays * 24 * 3600 * 1000));
	
	//if(expireDays != null){
	//	cookieString = cookieString + ';expires=' + currDate.toGMTString();
	//}
	var Then = new Date();       
	Then.setTime(Then.getTime()+36000*1000);
	cookieString = cookieString +";path=/;domain=.hc360.com;expires="+ Then.toGMTString() ;
	document.cookie = cookieString;
}

function getBbsCookie(name){
	if(document.cookie.length > 0){
		var begin = document.cookie.indexOf(name + '=');
		if(begin != -1){
			begin += name.length + 1;
			end = document.cookie.indexOf(';', begin);
			if(end == -1) end = document.cookie.length;
			return document.cookie.substring(begin, end);
		}else{
			return '';
		}
	}
	
	return '';

}

//---------------------
function realtimeShowCommentItem(oldFloorId){
	var oldFloor=document.getElementById(oldFloorId);

	if(!oldFloor) return;
	var oldTitle=_getNearNameObj(oldFloor.parentNode,"dt","previousSibling");
	var oldUser=oldTitle.getElementsByTagName("span")[0].innerHTML;
	var oldTime=oldTitle.getElementsByTagName("span")[1].innerHTML.slice(5);
	var oldContent=_getNearNameObj(oldFloor,"p","nextSibling").innerHTML;
	var oldFloorContent=oldFloor.innerHTML;
	var newFloorContent='<div class="commentItem marL10 marR10"><div><strong class="fontBlue"><span class="floatRight fontBlue">['+oldTime+']</span>'+oldUser+'</strong>'+oldFloorContent+'<p>'+oldContent+'</p></div></div>';

	return newFloorContent;
}

function realtimeShowCommentItem4hz(oldFloorId){
	var oldTitle=document.getElementById(oldFloorId);
	var oldFloor=document.getElementById(oldFloorId).getElementsByTagName("div")[0];
	var oldUser=oldTitle.getElementsByTagName("h4")[0].innerHTML;
	var oldTime=oldTitle.getElementsByTagName("h5")[0].innerHTML.slice(5);
	var oldContent,oldFloorContent,newFloorContent;
	if(oldFloor){
		oldContent=_getNearNameObj(oldFloor,"p","nextSibling").innerHTML;
		oldFloorContent=oldFloor.innerHTML;
		newFloorContent='<h4>'+oldUser+'</h4><h5>['+oldTime+']</h5><div>'+oldFloorContent+'</div><p>'+oldContent+'</p>';
	}else{
		oldContent=oldTitle.getElementsByTagName("p")[0].innerHTML;
		newFloorContent='<h4>'+oldUser+'</h4><h5>['+oldTime+']</h5><p>'+oldContent+'</p>';
	}
	return newFloorContent;
}

function _getNearNameObj(obj,tagName,direction){
	do{
		 obj=obj[direction]; 
	}while(obj && obj.nodeName.toLowerCase() !=tagName)
	return obj;
}